package com.itheima.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itheima.pojo.LogQueryParam;
import com.itheima.pojo.OperateLog;
import com.itheima.pojo.PageResult;
import com.itheima.service.OperateLogService;
import com.itheima.mapper.OperateLogMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author ch200
 * @description 针对表【operate_log(操作日志表)】的数据库操作Service实现
 * @createDate 2025-03-15 13:39:07
 */
@Service
public class OperateLogServiceImpl extends ServiceImpl<OperateLogMapper, OperateLog>
        implements OperateLogService {
    @Autowired
    private OperateLogMapper operateLogMapper;

    @Override
    public PageResult pageQuery(LogQueryParam logQueryParam) {
        //1.设置分页参数
        Integer page = logQueryParam.getPage();
        Integer pageSize = logQueryParam.getPageSize();
        //2.创建分页对象
        Page<OperateLog> p = new Page<>(page, pageSize);

        //调用方法进行分页
        operateLogMapper.page(p);
        return new PageResult(p.getTotal(), p.getRecords());


    }
}




